import { globby } from "globby";
import md5 from "md5-file";
import fs from "fs-extra";
//! 用于将 dist 目录下的指定后缀名的文件搬运到 data 目录下的指定文件夹
// 顶层文件夹 ts-node-esm .\src\collection.ts
const ext = "cpp";
const dest = "cpp";

const paths = await globby("./src/dist/**/*." + ext);
console.log(paths.length);
paths.forEach(async (i) => {
    const name = await md5(i);
    await fs.move(i, `./src/data/${dest}/` + name + "." + ext, {
        overwrite: true,
    });
});
